//
//  PlayerVIew.m
//  MiBaoTu
//
//  Created by mac004 on 2016/10/14.
//  Copyright © 2016年 com.caesartech15. All rights reserved.
//

#import "PlayerView.h"

@implementation PlayerView
-(NSMutableArray*)lrcDataArr{
    if (_lrcDataArr) {
        _lrcDataArr=[NSMutableArray new];
    }
    return _lrcDataArr;
}

-(instancetype)initWithFrame:(CGRect)frame{
    if (self=[super initWithFrame:frame]) {
        [self creatUI];
    }
    return  self;
}

-(void)creatUI{
    //背景图
    
    self.bgImgView=[[UIImageView alloc]initWithFrame:self.bounds];
    self.bgImgView.image=[UIImage imageNamed:@"bg1-1024-2"];
    [self addSubview:self.bgImgView];
    //背景覆盖层
    UIView*BGView=[[UIView alloc]initWithFrame:self.bounds];
    BGView.backgroundColor=[UIColorFromHex(0x000000) colorWithAlphaComponent:0.65];
    [self addSubview:BGView];
    [self insertSubview:BGView aboveSubview:self.bgImgView];
    
   //大图
    self.bigImg=[[UIImageView alloc]initWithFrame:CGRectMake(150 *PERCEN, 250*PERCEN, SCREEN_WIDTH/2048*800, SCREEN_WIDTH/2048*800)];
    self.bigImg.image=[UIImage imageNamed:@"bofangqi_moren"];
    self.bigImg.userInteractionEnabled = YES;
    [BGView addSubview:self.bigImg];
    //大图覆盖层
    UIView * coverView=[[UIView alloc]initWithFrame:self.bigImg.bounds];
    coverView.backgroundColor=[UIColorFromHex(0x000000) colorWithAlphaComponent:0.5];
    coverView.userInteractionEnabled = YES;
    [self.bigImg addSubview:coverView];
    
    //播放按钮
    self.playBtn=[UIButton buttonWithType:UIButtonTypeCustom];
    self.playBtn.frame=CGRectMake(coverView.width/2-80*PERCEN   , coverView.width/2-80*PERCEN, 160*PERCEN, 160*PERCEN);
    self.playBtn.hidden=YES;
 
    [self.playBtn setImage:[UIImage imageNamed:@"bofang"] forState:0];
    [self.playBtn setImage:[UIImage imageNamed:@"zanting"] forState:UIControlStateSelected];
    self.playBtn.userInteractionEnabled=YES;
//    [self.playBtn addTarget:self action:@selector(playOrPause) forControlEvents:UIControlEventTouchUpInside];
    [coverView addSubview:self.playBtn];
    //进度条
    self.progressSlider=[[UISlider alloc]initWithFrame:CGRectMake(self.bigImg.left+25*PERCEN, self.bigImg.bottom+20*PERCEN, self.bigImg.width-50*PERCEN, 4*PERCEN)];
    self.progressSlider.minimumValue=0;
    self.progressSlider.maximumValue=1;
    self.progressSlider.value=0;
    self.progressSlider.maximumTrackTintColor=UIColorFromHex(0xffffff);
    self.progressSlider.minimumTrackTintColor=UIColorFromHex(0xeb6fa7);
     [ self.progressSlider setThumbImage:[UIImage imageNamed:@"lunbo1"] forState:UIControlStateNormal];
    [BGView addSubview:self.progressSlider];
    
    self.currentLabel=[[UILabel alloc]initWithFrame:CGRectMake(self.progressSlider.left, self.progressSlider.bottom+20*PERCEN, self.progressSlider.width, 30*PERCEN)];
    self.currentLabel.text=@"准备录制00:00/15:00";
    self.currentLabel.font=[UIFont systemFontOfSize:30*PERCEN];
    self.currentLabel.textAlignment=NSTextAlignmentCenter;
    self.currentLabel.textColor=UIColorFromHex(0xffffff);
    [BGView addSubview:self.currentLabel];
    //重录
    self.RerecodBtn=[UIButton buttonWithType:UIButtonTypeCustom];
      self.RerecodBtn.frame=CGRectMake(280*PERCEN, self.height-250*PERCEN, 110*PERCEN, 110*PERCEN);
    self.RerecodBtn.layer.cornerRadius=self.RerecodBtn.bounds.size.width/2;
    self.RerecodBtn.layer.masksToBounds=YES;
    self.RerecodBtn.layer.borderWidth=2*PERCEN;
    self.RerecodBtn.layer.borderColor=UIColorFromHex(0xffffff).CGColor;
    self.RerecodBtn.titleLabel.font=[UIFont systemFontOfSize:30*PERCEN];
    [self.RerecodBtn setTitleColor:UIColorFromHex(0xffffff) forState:0];
    [self.RerecodBtn setTitle:@"重录" forState:0];
  
//    [self.RerecodBtn addTarget:self action:@selector(record) forControlEvents:UIControlEventTouchUpInside];
    self.RerecodBtn.hidden=YES;
    [BGView addSubview:self.RerecodBtn];
    //继续录音
    self.continueBtn=[UIButton buttonWithType:UIButtonTypeCustom];
    self.continueBtn.frame=CGRectMake(self.RerecodBtn.right+80*PERCEN   , self.height-280*PERCEN, 160*PERCEN, 160*PERCEN);

    self.continueBtn.layer.cornerRadius=self.continueBtn.bounds.size.width/2;
    self.continueBtn.layer.masksToBounds=YES;
    self.continueBtn.layer.borderWidth=2*PERCEN;
    self.continueBtn.layer.borderColor=UIColorFromHex(0xffffff).CGColor;
    self.continueBtn.titleLabel.font=[UIFont systemFontOfSize:30*PERCEN];
    [self.continueBtn setTitleColor:UIColorFromHex(0xffffff) forState:0];
    [self.continueBtn setTitle:@"录制" forState:0];
   //    [self.continueBtn addTarget:self action:@selector(continueR) forControlEvents:UIControlEventTouchUpInside];
    [BGView addSubview:self.continueBtn];
    //发布
    self.publishBtn=[UIButton buttonWithType:UIButtonTypeCustom];
     self.publishBtn.frame=CGRectMake(self.continueBtn.right+80*PERCEN   , self.height-250*PERCEN, 110*PERCEN, 110*PERCEN);
    //label.layer.cornerRadius = label.bounds.size.width/2;
   // label.layer.masksToBounds = YES;
    self.publishBtn.layer.cornerRadius=self.publishBtn.bounds.size.width/2;
    self.publishBtn.layer.masksToBounds=YES;
    self.publishBtn.layer.borderWidth=2*PERCEN;
    self.publishBtn.layer.borderColor=UIColorFromHex(0xffffff).CGColor;
    self.publishBtn.titleLabel.font=[UIFont systemFontOfSize:30*PERCEN];
    [self.publishBtn setTitleColor:UIColorFromHex(0xffffff) forState:0];
    self.publishBtn.hidden=YES;
    [self.publishBtn setTitle:@"发布" forState:0];
   
//    [self.publishBtn addTarget:self action:@selector(publish) forControlEvents:UIControlEventTouchUpInside];
    [BGView addSubview:self.publishBtn];
    
}

    

@end
